package com.damage.supplier.web;

import com.damage.common.object.BaseResp;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@ResponseBody
@RequestMapping("/purchaseInvoice")
@Slf4j
public class CompleteOrderController {

    @Autowired
    private TaskService taskService;

    @PostMapping("confirm/complete/{id}")
    public BaseResp completeConfirmCompleteOrder(@PathVariable("id") String taskId){
        try {
            taskService.complete(taskId);
            return BaseResp.ok();
        } catch (Exception e) {
            log.error("完成任务失败，任务:{}",taskId);
            e.printStackTrace();
            return BaseResp.error(e.getMessage());
        }
    }
}
